/**
 * @(#) AcquisitionScheduler.java
 *
 * @author lihg
 * @version V1.0 2013-10-6
 *
 * Copyright (C) 2010,2013 , Lihg
 */

/**
 * 
 */
package cn.com.dshome.acquisition.scheduler;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;

import cn.com.dshome.acquisition.exception.AcquisitionException;
import cn.com.dshome.acquisition.service.IAcquisitionService;
import cn.com.dshome.acquisition.vo.QiDianNovelInformation;

/**
 * 
 * Purpose:
 * 
 * @author lihg
 * @see
 * @since
 */
@Service
public class AcquisitionScheduler {
	@Autowired
	private TaskExecutor taskExecutor ;
	@Autowired
	private IAcquisitionService acquisitionService ;

	//记录日志
	private Log log = LogFactory.getLog(AcquisitionScheduler.class) ;
	/**
	 * 主监控每隔5分钟监控一次
	 * 0 0/5 * * * ?
	 * @author lihg
	 * @version V1.0 2013-8-6
	 */
	//	@Scheduled(cron = "0 0/5 * * * ?")
	public void acquisition()  {
		log.error("开始采集啦！") ;
		//异步运行监控程序
		taskExecutor.execute(new Runnable() {
			@Override
			public void run() {
				try {
					acquisitionService.listInformations(QiDianNovelInformation.class) ;
				} catch (AcquisitionException e) {
					e.printStackTrace();
				}
			}
		}) ;
	}
}


/**
 * Revision history
 * -------------------------------------------------------------------------
 * 
 * Date Author Note
 * -------------------------------------------------------------------------
 * 2013-10-6 上午09:40:22 lihg 创建版本
 */